package com.itplh.modules.shirorealm.controller;

import org.apache.shiro.authc.AccountException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Description:
 * @Author: tanpeng
 * @Date: 2019-07-11 18:47
 * @Version: V1.0
 */
@RestControllerAdvice
public class ExceptionController {

    /**
     * 捕捉 CustomRealm 抛出的异常
     * @param e
     * @return
     */
    @ExceptionHandler(AccountException.class)
    public String handleShiroException(Exception e) {
        return e.getMessage();
    }
}
